<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>测试</button>
    
    <script src="./axios.js"></script>
    
    <script>
        const btn= document.querySelector('button');
         btn.addEventListener('click', function () {
        //     myAxios({
        //     url:'http://ajax-api.itheima.net/api/city',
        //     method:'GET',
        //     params:{
        //         pname:'浙江省'
        //     }

        // }).then((res)=>{console.log(res)})
        // .catch(err => console.log(err))

        // myAxios({
        //     url:'http://ajax-api.itheima.net/api/login',
        //     method:'POST',
        //     data:{
        //         username:'admin',
        //         password:'123456'
        //     }
            
        // }).then((res)=>{console.log(res)})
        myAxios({
            url:'http://ajax-api.itheima.net/api/login',
            method:'POST',
            data:'username=admin&password=123456'
            
        }).then((res)=>{console.log(res)})

        // setParams({
        //     pname:'浙江省'
        // })
             
         });
        

    </script>
</body>
</html>